
#ifndef HIGH_LOW_H
#define HIGH_LOW_H

#include <Arduino.h>

// 设置指定IO的高低电平，支持多任务
class HighLow
{
public:
	HighLow(byte pin);
	HighLow(byte pin,const char* name);
	HighLow(byte pin,unsigned int duration);
	HighLow(byte pin,unsigned int duration,const char* name);
    HighLow();
	~HighLow();

	void h() const;
	void l() const;
	void t(unsigned int d) const;
    void task();
    void startTask();
    void endTask();
    static void doTask(void*);
private:
	byte _pin;
    const char* _name;
    unsigned int _duration;
    TaskHandle_t _taskHandle;
};

#endif
